#!/bin/bash

# 定义变量方便修改
table_db=cy_database.
hive=/home/software/hive-2.3.6/bin/hive

# 如果是输入的日期按照取输入日期；如果没输入日期取当前时间的前一天
if [ -n "$1" ] ;then
	do_date=$1
else
	do_date=`date -d "-1 day" +%F`
fi

sql="
with
tmp1_table as 个人信息少了人群类型
(
select
	name,
	idcard,
	null user_type,
	area_code as now_address,
	startup_code,
	phone,
	now_work_company as ent_name,
	cast(current_date() as string) as update_time
from dws_person_detail

)


insert overwrite table cy_database.ads_big_screen_result_rc_info
select name,idcard,user_type,now_address,startup_code,phone,ent_name,update_time from tmp1_table

;
"
$hive -e "$sql"